<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>七颗牙学堂</title>
    <style>
        body {
            width: 100%;
        }
        
        .view,
        #view {
            width: 100%;
            height: 100vh;
            overflow-y: scroll;
            overflow-x: hidden;
        }
    </style>

</head>

<body>
    <div class="view">
        <iframe id="view"></iframe>
    </div>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript">
        $(function() {
            function GetQueryString(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);
                return null;
            }

            function CheckIsAndroid() {
                var browser = {
                        versions: function() {
                            var u = navigator.userAgent,
                                app = navigator.appVersion;
                            return { //移动终端浏览器版本信息 
                                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 
                                android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器 //u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
                                iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 
                                iPad: u.indexOf('iPad') > -1, //是否iPad 
                            };
                        }(),
                    }
                    //if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {
                    //    return false;
                    //}
                if (browser.versions.android)
                    return true;
                return false;
            }
            // 测试 正式
            var url = 'https://n.qikeya.com/qkyPay/code/img/'
            var url1 = 'https://n.qikeya.com/qkyPay/code/PDF/web/viewer.html'

            // 正式
            // var url = 'https://oss.qikeya.cn/qkyPay/code/img/'
            // var url1 = 'https://oss.qikeya.cn/qkyPay/PDF/web/viewer.html'

            var pdf = url + GetQueryString('href');
            if (!CheckIsAndroid()) {
                // window.open(pdf, '_blank');
                //     //如果是IOS
                // $('#view').attr('src', pdf);
                $('#view').attr('src', url1 + '?file=' + encodeURIComponent(encodeURI(pdf)) + '');
                // window.location.href = pdf;
            }
            if (CheckIsAndroid()) {
                // 如果是Android
                $('#view').attr('src', url1 + '?file=' + encodeURIComponent(encodeURI(pdf)) + '');
            }
        })
    </script>
</body>

</html>